package cn.itrip.biz.controller;


import cn.itrip.beans.dtos.Dto;
import cn.itrip.beans.dtos.InputDto;
import cn.itrip.beans.pojo.ItripAreaDic;
import cn.itrip.beans.pojo.ItripLabelDic;
import cn.itrip.beans.vo.ImageVo;
import cn.itrip.beans.vo.biz.GetVideoDesc;
import cn.itrip.beans.vo.biz.ListQueryHotelCity;
import cn.itrip.beans.vo.biz.ListQueryHotelDetails;
import cn.itrip.biz.service.IItripHotelService;
import cn.itrip.biz.service.IItripLabelDicService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 酒店表 前端控制器
 * </p>
 *
 * @author 滕召伟
 * @since 2020-02-27
 */
@RestController
@RequestMapping("/biz/api/hotel")
public class ItripHotelController {
    @Resource
    IItripHotelService iItripHotelService;
    @Resource
    IItripLabelDicService iItripLabelDicService;

    @ApiOperation(value = "图片查询", httpMethod = "Get", produces = "application/json;charset=utf-8", protocols = "HTTP", response = Dto.class, notes = "图片查询")
    @GetMapping(value = "/getimg/{hotelId}", produces = "application/json;charset=utf-8")
    private Dto listPicture(@ApiParam(name = "hotelId", value = "根据id查询图片", required = true) @PathVariable Long hotelId) {
        List<ImageVo> list = iItripHotelService.listHotelId(hotelId);
        if (list != null) {
            return InputDto.data(list);
        }
        return InputDto.error("酒店图片查询失败!");
    }

    /**
     * 根据类型获取国内外酒店列表
     *
     * @param hotelType
     * @return
     */
    @GetMapping(value = "/queryhotcity/{type}",produces = "application/json;charset=utf-8")
    public Dto listQueryHotelCity(@PathVariable("type") Integer hotelType) {
        List<ListQueryHotelCity> list = iItripHotelService.listItripHotel(hotelType);
        return InputDto.data("查询成功", list);
    }

    /**
     * 获取特色酒店列表
     *
     * @return
     */
    @GetMapping(value = "/queryhotelfeature",produces = "application/json;charset=utf-8")
    public Dto listQueryHotelFeature() {
        List<ItripLabelDic> list = iItripLabelDicService.listItripLabelDicById(16);
        return InputDto.data("查询成功", list);
    }

    /**
     * 根据酒店编号查询酒店显示信息
     *
     * @param hotelId
     * @return
     */
    @GetMapping(value = "/getvideodesc/{hotelId}",produces = "application/json;charset=utf-8")
    public Dto getVideoDesc(@PathVariable("hotelId") Integer hotelId) {
        GetVideoDesc getVideoDesc = iItripHotelService.getGetVideoDescByHotelId(hotelId);
        return InputDto.data("查询成功", getVideoDesc);
    }

    /**
     * 根据酒店编号获取酒店介绍信息
     *
     * @param hotelId
     * @return
     */
    @GetMapping(value = "/queryhoteldetails/{hotelId}",produces = "application/json;charset=utf-8")
    public Dto listQueryHotelDetails(@PathVariable("hotelId") Integer hotelId) {
        List<ListQueryHotelDetails> list = iItripHotelService.ListQueryHotelDetails(hotelId);
        return InputDto.data(list);
    }

    /**
     * 根据酒店编号获取酒店设施列表
     *
     * @param hotelId
     * @return
     */
    @GetMapping(value = "/queryhotelfacilities/{hotelId}",produces = "application/json;charset=utf-8")
    public Dto queryHotelFacilities(@PathVariable("hotelId") Integer hotelId) {
        String ret = iItripHotelService.getQueryHotelFacilities(hotelId);
        return InputDto.data(ret);
    }

    /**
     * 根据酒店编号获取酒店政策
     *
     * @param hotelId
     * @return
     */
    @GetMapping(value = "/queryhotelpolicy/{hotelId}",produces = "application/json;charset=utf-8")
    public Dto queryHotelPolicy(@PathVariable("hotelId") Integer hotelId) {
        String ret = iItripHotelService.queryHotelPolicy(hotelId);
        return InputDto.data(ret);
    }

    /**
     * 根据城市编号查询
     *
     * @return
     */
    @GetMapping(value = "/querytradearea/{cityIdValue}",produces = "application/json;charset=utf-8")
    public Dto queryTradeArea(@PathVariable("cityIdValue") Integer cityId) {
        List<ItripAreaDic> list = iItripHotelService.QueryTradeArea(cityId);
        return InputDto.data(list);
    }
}

